import Vue from 'vue'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';

import Index from './src/component/Index';

import authorityService from './src/service/AuthorityService.js';
import configService from './src/service/ConfigService.js';
import utilService from './src/service/UtilService.js';
import {eventHub} from './src/service/EventHub.js';
import md5 from './src/service/Md5.js';
import router from './src/router/router.js';
import http from './src/http/http.js';


Vue.use(ElementUI);
Vue.prototype.$http = http

/**
 * 启动VUE
 */
Vue.config.productionTip = true;

async function startApp(container) {
  await authorityService.initAuthority(http);
  let vue = new Vue({el: container, router, components: {Index}, template: '<Index/>'})
  window.alert = vue.$message.info;
  window.error = vue.$message.error;
  return vue;
}


export {router, http, startApp, authorityService, configService, utilService, eventHub, md5};
